/** Action */
package domain.action;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

/**
 * Enumeration for valid actions to be performed on the server.
 * @author jessienewman
 * @version $Revision: 1.0 $
 */
public enum Action {
	
	/** Field LOGIN. */
	LOGIN("login"),
	/** Field GET_PATIENT. */
	GET_PATIENT("getPatient"),
	
	FIND_PATIENTS("findPatients"),
	
	GET_ALL_PATIENTS("getAllPatients"),
	
	MODIFY_DOB("modifyDob"),
	
	MODIFY_ALLERGIES("modifyAllergies"),
	
	MODIFY_INSURANCE("modifyInsurance"),
	
	MODIFY_CONTACT("modifyContact"),
	
	FIND_USERS("findUsers"),
	
	GET_USER_ID("getUserId"),
	
	IS_VALID_USERNAME("isValidUsername"),
	
	GET_USER("getUser"),
	
	MODIFY_NAME("modifyName"),
	
	SET_ACTIVE("setActive"),
	
	ADD_USER("addUser"),
	
	GET_DOCTOR("getDoctor"),
	
	GET_ALL_DOCTORS("getAllDoctors"),
	
	ADD_APPOINTMENT("addAppointment"),
	
	REMOVE_APPOINTMENT("removeAppointment"),
	
	GET_PATIENT_APPOINTMENTS("getPatientAppointments"),
	
	GET_DOCTOR_APPOINTMENTS("getDoctorAppointments"),
	
	GET_LAST_MONTH_DOCTOR_APPOINTMENTS("getLastMonthDoctorAppointments"),
	
	GET_FUTURE_DOCTOR_APPOINTMENTS("getFutureDoctorAppointments"),
	
	GET_FUTURE_PATIENT_APPOINTMENTS("getFuturePatientAppointments"),
	
	SAVE_APPOINTMENT("saveAppointment"),
	
	GET_ALL_NURSES("getAllNurses"),
	
	GET_ALL_SERVICES("getAllServices");
	
	/** Field action. */
	private final String actionString;
	
	/** Field lookup.	 */
	private static final Map<String,Action> LOOKUP = new HashMap<String,Action>();
	
	static {
	    for(Action action : EnumSet.allOf(Action.class))
	         LOOKUP.put(action.toString(), action);
	}
	
	/**
	 * Constructor for Action.
	 * @param action String
	 */
	private Action(final String action) {
		this.actionString = action;
	}
	
	/**
	 * Method toString.
	 * @return String
	 */
	public String toString() {
		return actionString;
	}
	
	/**
	 * Method getAction.
	 * @param action String
	 * @return Action
	 */
	public static Action getAction(final String action) {
		return LOOKUP.get(action);
	}
	
}
